home *** CD-ROM | disk | FTP | other *** search
/ Crosscountry USA Photo Safari / Crosscountry USA Photo Safari.iso / Data / cc_base / pak00_16bit_f.pk3 / system.tab.p < prev    next >
Text File  |  2003-01-03  |  10KB  |  297 lines

  1. {
  2.   X = -230;
  3.   Y = 60;
  4.   state = 0;
  5.   rest_x = -230;
  6.   expand_x = -10;
  7.   Hidden = 1;
  8.  
  9.   ScriptID = script {
  10.     @loaded {
  11.       resid plateID;
  12.       resid tabID;
  13.       int   plate_width;
  14.       
  15.       plateID = GuiChildByName(SELF, "plate");
  16.       tabID   = GuiChildByName(SELF, "tab");
  17.  
  18.       plate_width = ResPropGetInt(plateID, "Width");
  19.       ResPropSetInt(SELF, "rest_x", - plate_width);
  20.       
  21.       ResPropSetInt(tabID, "X", plate_width - 4);
  22.     }
  23.   }; 
  24.   
  25.   ChildID = {
  26.  
  27.     GuiAnimation("plate") {
  28.       AnimationID = "gui/dash/tab/plate/plate.pcx";
  29.       X = 0;
  30.       Width = 235;
  31.       Height = 180;
  32.     },
  33.     GuiAnimation("tab") {
  34.       X = 240;
  35.       Y = 11;
  36.       AnimationID = "gui/dash/tab/system/system_off.pcx";
  37.       ScriptID = script {
  38.         @activate {
  39.           resid Parent;
  40.           resid Player;
  41.           resid Game;
  42.           Game = ResByName("Game");
  43.           Player = ResPropGetResID(ResByName("Game"),"game_cur_player");          
  44.           Parent = GuiParent(SELF);
  45.  
  46.           if ( ResPropGetResID(Player,"truck_tab_expanded") == Parent) {
  47.             ResPropSetResID(Player,"truck_tab_expanded",RES_INVALID);
  48.             ResPropSetInt(GuiSiblingByName("menu_layer"),"Hidden",TRUE);
  49.             ResPropSetInt(GuiSiblingByName("save_layer"),"Hidden",TRUE);
  50.           } else {
  51.             ResPropSetInt(GuiSiblingByName("menu_layer"),"Hidden",FALSE);
  52.             ResPropSetInt(GuiSiblingByName("save_layer"),"Hidden",TRUE);          
  53.             ResPropSetResID(Player,"truck_tab_expanded",Parent);
  54.             GuiToFront(Parent);
  55.           }
  56.         }
  57.         @animate {
  58.           resid Parent;
  59.           int state;
  60.           resid Player;
  61.           resid Game;
  62.           Game = ResByName("Game");
  63.           Player = ResPropGetResID(ResByName("Game"),"game_cur_player");          
  64.           Parent = GuiParent(SELF);
  65.  
  66.           if ( ResPropGetResID(Player,"truck_tab_expanded") == Parent) {
  67.             ResPropSetInt(Parent,"X",ResPropGetInt(Parent,"expand_x"));
  68.             ResPropSetInt(GuiSiblingByName("plate"),"Hidden",FALSE);
  69.           } else {
  70.             ResPropSetInt(GuiSiblingByName("plate"),"Hidden",TRUE);
  71.             ResPropSetInt(Parent,"X",ResPropGetInt(Parent,"rest_x"));
  72.           }
  73.         }
  74.       }     
  75.       },
  76.  
  77.     GuiLayer("menu_layer") {
  78.       X = 20;    
  79.       Y = 10;
  80.       ChildID = {
  81.       
  82.       
  83.             GuiTextInput("menu_message") {
  84.           X = 0;
  85.           Y = 0;
  86.           Width = 190;
  87.           Height = 40;
  88.           WordWrap = TRUE;
  89.           InputDisabled = TRUE;
  90.           FontID = "font/tab_w_on_g.tf";
  91.           ScriptID = Script {
  92.             @show {
  93.               ResPropSetStr(SELF,"InputText",MangleSIDToStr(232/*"Use this menu to save your game."*/));
  94.             }
  95.  
  96.           };
  97.         },
  98.         
  99.  
  100.         
  101.         GuiButton("save_button") {
  102.           X = 45;
  103.           Y = 50;
  104.           TextID = Mangle(233/*"Save Game"*/);
  105.           StyleID = "gui/dash/tab/button/tab.gbs";
  106.           FontID = "font/tab_button.tf";
  107.           Width = 120;
  108.           AutoSize = Height;
  109.           ScriptID = Script {
  110.             @activate { 
  111.               resid Player;
  112.               resid Game;
  113.               
  114.               Game = ResByName("Game");
  115.               Player = ResPropGetResID(ResByName("Game"),"game_cur_player");
  116.               
  117.               if (ResPropGetInt(Player,"nav_at_city") == 1) {
  118.                 ResPropSetInt(GuiUncleByName("save_layer"),"Hidden",FALSE);   
  119.                 ResPropSetInt(GuiParent(SELF),"Hidden",TRUE);       
  120.               } else {
  121.                 ResPropSetStr(GuiSiblingByName("menu_message"),"InputText",MangleSIDToStr(234/*"You must be at a city to save. Drive to the next city."*/));
  122.               }
  123.     
  124.             }
  125.           }
  126.         },
  127.         
  128.         GuiButton("quit_game") {
  129.           X = 45;
  130.           Y = 90;
  131.           TextID = Mangle(235/*"Quit Game"*/);
  132.           StyleID = "gui/dash/tab/button/tab.gbs";
  133.           FontID = "font/tab_button.tf";
  134.           Width = 120;
  135.           AutoSize = Height;
  136.           ScriptID = Script {
  137.             @activate {
  138.               
  139.               ResParseEvent(ResByName("common/init_game_objects.c4"), "@init_game_objects"); 
  140.               release("floor");
  141.               mark("floor");
  142.             
  143.               ResByName("splash_screen.gl");
  144.             }
  145.           }
  146.         },
  147.  
  148.         GuiButton("exit_program") {
  149.           X = 45;
  150.           Y = 130;
  151.           TextID = Mangle(236/*"Exit Program"*/);
  152.           StyleID = "gui/dash/tab/button/tab.gbs";
  153.           FontID = "font/tab_button.tf";
  154.           Width = 120;
  155.           AutoSize = Height;
  156.           ScriptID = Script {
  157.             @activate { 
  158.               Command("quit");
  159.             }
  160.           }
  161.         }      
  162.  
  163.       };
  164.     },/* end of menu_layer */
  165.  
  166.  
  167.     
  168.     GuiLayer("save_layer") {
  169.       X = 20;    
  170.       Y = 10;
  171.       Hidden = 1;
  172.       ChildID = {
  173.  
  174.             GuiTextInput("save_message") {
  175.           X = 0;
  176.           Y = 0;
  177.           Width = 190;
  178.           Height = 50;
  179.           WordWrap = TRUE;
  180.           InputDisabled = TRUE;
  181.           FontID = "font/tab_w_on_g.tf";
  182.           ScriptID = Script {
  183.             @show {
  184.               ResPropSetStr(SELF,"InputText",MangleSIDToStr(237/*"Type a name for your game and click save. File names must have less than 27 characters."*/));            
  185.             }
  186.           };
  187.         },
  188.  
  189.         
  190.             GuiTextInput("save_filename") {
  191.           AnimationID = "gui/square/window/window_text_entry.pcx";
  192.           X = 25;
  193.           Y = 75;
  194.           Width = 140;
  195.           Height = 22;
  196.           FontID = "font/verdana_9_black.tf";
  197.           InsertCursorID = "gui/dash/tab/insert_cursor.pcx";
  198.           OverwriteCursorID = "gui/dash/tab/overwrite_cursor.pcx";
  199.           InputText = "";
  200.           ScriptID = Script {
  201.            @show { 
  202.               resid Game;            
  203.               Game = ResByName("Game");
  204.              
  205.               if (! StrExact("",ResPropGetStr(Game, "game_save_name"))) {
  206.                 ResPropSetStr(SELF,"InputText",ResPropGetStr(Game, "game_save_name"));
  207.               }
  208.            }
  209.           };
  210.         },
  211.         
  212.         GuiButton("back") {
  213.           X = 35;
  214.           Y = 120;
  215.           TextID = Mangle(238/*"Back"*/);
  216.           StyleID = "gui/dash/tab/button/tab.gbs";
  217.           FontID = "font/tab_button.tf";
  218.           Width = 60;
  219.           AutoSize = Height;
  220.           ScriptID = Script {
  221.             @activate { 
  222.               ResPropSetInt(GuiUncleByName("menu_layer"),"Hidden",FALSE);   
  223.               ResPropSetInt(GuiParent(SELF),"Hidden",TRUE);       
  224.             }
  225.           }
  226.         },
  227.         GuiButton("save") {
  228.           X = 105;
  229.           Y = 120;
  230.           TextID = Mangle(239/*"Save"*/);
  231.           StyleID = "gui/dash/tab/button/tab.gbs";
  232.           FontID = "font/tab_button.tf";
  233.           Width = 60;
  234.           AutoSize = Height;
  235.           ScriptID = Script {
  236.             @activate { 
  237.               resid Player;
  238.               resid Game;
  239.               str filename;
  240.               str full_path;
  241.               
  242.               Game = ResByName("Game");
  243.               Player = ResPropGetResID(Game,"game_cur_player");
  244.               
  245.               /* get the filename */
  246.               filename = ResPropGetStr(GuiSiblingByName("save_filename"),"InputText");
  247.               
  248.               /* stop right now if there is nothing */
  249.               if (StrExact("",filename)) {
  250.                 ResPropSetStr(GuiSiblingByName("save_message"),"InputText",MangleSIDToStr(240/*"You must type a file name."*/));              
  251.                 stop;
  252.               }
  253.               
  254.               /* check that the length of the filename is not too long */
  255.               if (StrLen(filename) >= 27) {
  256.                 ResPropSetStr(GuiSiblingByName("save_message"),"InputText",MangleSIDToStr(241/*"The file name you have chosen is too long."*/));
  257.                 stop;
  258.               }
  259.               
  260.               /* set this name in the game object so we dont keep asking the user */
  261.               ResPropSetStr(Game, "game_save_name", filename);
  262.                      
  263.               /* form the full path */
  264.               if (StrIn(filename, ".sav")) {
  265.                 full_path = StrFormatStr("%s%s", CVarGetStr("SavedGameDir"),filename);
  266.               } else {
  267.                 filename = StrFormatStr("%s.sav", filename);
  268.                 full_path = StrFormatStr("%s%s", CVarGetStr("SavedGameDir"),filename);
  269.               }              
  270.               
  271.               /* check if the file exists*/
  272.               if (FileExist(full_path)) {
  273.                 /* only bitch about new filenames that exist */                       
  274.                 if (! StrExact(StrFormatStr("%s.sav", ResPropGetStr(Game,"game_save_name")),filename)) {
  275.                   ResPropSetStr(GuiSiblingByName("save_message"),"InputText",MangleSIDToStr(242/*"The file name you have chosen already exists."*/));
  276.                   stop;
  277.                 }
  278.               } 
  279.  
  280.               /* save the game */
  281.               if (ResSaveAs(ResByName("Game"),full_path)) {
  282.                 ResPropSetStr(GuiSiblingByName("save_message"),"InputText",StrFormatStr(MangleSIDToStr(243/*"Your game has been saved to '%s'."*/), filename));
  283.                 ResPropSetInt(GuiUncleByName("menu_layer"),"Hidden",FALSE);
  284.                 ResPropSetInt(GuiParent(SELF),"Hidden",TRUE);
  285.               } else {
  286.                 ResPropSetStr(GuiSiblingByName("save_message"),"InputText",MangleSIDToStr(244/*"Could not save game. Check save game path."*/));
  287.               }             
  288.             }
  289.           }
  290.         }
  291.       };
  292.     } /* end of save_layer */
  293.  
  294.     
  295.   };
  296. }
  297.